<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.w3.org/1999/xhtml">

<head>
    <th:block th:include="common/common_head :: commonHeader('订单管理')"/>
    <link rel="stylesheet" th:href="@{/static/js/plugins/jquery-layout/jquery.layout-latest.css}">
    <link rel="stylesheet" th:href="@{/static/js/editable/css/bootstrap-editable.css}">
	<!-- <style type="text/css">.table {table-layout:fixed;}</style> -->
</head>

<body class="gray-bg">

<div class="container-div ui-layout-center">
    <div class="row">
		<div class="col-sm-12 search-condition">
			<form id="deliverForm" th:action="@{/deliver/list}" class="form-inline">
				<div class="select-list">
				<ul>
					<li class="col-sm-3" style="width: 33%">
					<label style="width: 120px">发货单号：</label>
					<input type="text" name="deliverNo" />
					</li>
					<li class="col-sm-3" style="width: 33%">
					<label style="width: 120px">订单号：</label>
					    <input type="text" name="poNo"/>
					</li>
					<li class="col-sm-3" style="width: 33%">
					<button id="deliverSearchBtn" type="button" class="btn btn-primary btn-rounded btn-sm"><i class="fa fa-search"></i>&nbsp;搜索</button>
					<button class="btn btn-warning btn-rounded btn-sm" type="reset"><i class="fa fa-eraser"></i>&nbsp;重置</button>
					<button id="deliverAdvancedSearch" type="button" class="btn btn-primary btn-rounded btn-sm" style="display: none"><i class="fa fa-caret-down"></i>&nbsp;高级搜索</button>
					</li>
				</ul>
				</div>
				</form>
		</div>
	    <div class="col-sm-12 select-info order-table">
			<!--<div class="btn-group hidden-xs toolbar" id="deliverToolBar" role="group">
				<a class="btn btn-outline btn-success btn-rounded" onclick="toSendSap()">
					<i class="fa fa-edit"></i> 同步SAP
				</a>
			</div>-->
			<table id="deliver" data-mobile-responsive="true"></table>
		</div>
    </div>
</div>

<!--引入公共js-->
<div th:include="common/onload_js :: onloadJS"></div>
<script type="text/javascript" th:src="@{/static/js/plugins/jquery-layout/jquery.layout-latest.js}"></script>

<script type="text/javascript">
    //面向对象
    var searcherBS = Searcher.createBS('#deliver',
        [
		{checkbox: true},
		{title: '发货单号', field:'deliverNo'},
		{title: '发货状态', field:'status',
			formatter: function (value, row, index) {
                if (row.status == "2" ) {
                    return '订单分批发货';
                } else {
                    return '订单发货完毕';
                }
            }
		},
		{title: '发货时间', field:'deliverTime'//,
		},
		{title: '行项目号', field:'itemNo'},
		{title: '订单号', field:'poNo'},
		{title: '发货数量', field:'shippedQty'},
		//{title: '二维码的url', field:'photoUrl'},
		{title: "二维码下载",field:'',
            formatter: function(value,row,index){
               return '<a class="btn btn-outline btn-success btn-rounded" onclick="Download(\' ' + row.pkId + ' \');">二维码下载</a>';
            }
		}
        ]
    );
    
    function Download(obj){
	    var poItemId = obj;
        window.location.href = ctxPath + "/deliver/toDwnload?id="+poItemId;
    }
    
    /**
     * 查询数据
     */
    function refresh() {
    	searcherBS.refresh();
    }
    
    $(function () {
    	initDictDataSel();//初始化所有字典数据
    });
 
</script>
</body>
</html>